package com.nyist.controller;

import com.nyist.service.PayHystrixUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class PayHystrixController {

    @Resource
    private PayHystrixUserService payHystrixUserService;

    @GetMapping("/provider/hystrix/ok/{id}")
    public String printInfo_OK(@PathVariable("id") Integer id){
        String infoOk = payHystrixUserService.printInfo_OK(id);
        return infoOk;
    }

    @GetMapping("/provider/hystrix/timeout/{id}")
    public String printInfo_TimeOut(@PathVariable("id") Integer id){
        String infoTimeOut = payHystrixUserService.printInfo_TimeOut(id);
        return infoTimeOut;
    }


    //===========服务熔断
    @GetMapping(value = "/provider/hystrix/circuit/{id}")
    public String paymentCircuitBreaker(@PathVariable("id") Integer id){
        String result = payHystrixUserService.paymentCircuitBreaker(id);
        return result;
    }
}
